﻿namespace Exporter.Exporters.Implementations
{
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using MoviesDataBase;

    /// <summary>
    /// The text file exporter.
    /// </summary>
    public class TextExporter : IFileExporter
    {
        #region IFileExporter Membres

        /// <summary>
        /// Exports the specified fil name.
        /// </summary>
        /// <param name="filName">Name of the fil.</param>
        /// <param name="movies">The movies.</param>
        public void Export(string filName, IEnumerable<MoviesDataBase.Movie> movies)
        {
            StringBuilder builder = new StringBuilder();
            foreach (Movie movie in movies)
            {
                builder.AppendLine(movie.Title);
            }

            File.WriteAllText(filName, builder.ToString());
        }

        #endregion
    }
}
